/*
This file is part of maven-rabbit-plugin.

maven-rabbit-plugin is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

maven-rabbit-plugin is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with maven-rabbit-plugin.  If not, see <http://www.gnu.org/licenses/>.
*/
package org.opensource.maven.rabbit;

import org.apache.maven.plugin.MojoExecutionException;

import java.io.IOException;
import org.opensource.nabaztag.RabbitException;

/**
 * Send a TTS message to Nabaztag.
 *
 * @goal say
 */
public class SayMojo extends AbstractRabbitMojo {

    /**
     * TTS message send to the Nabaztag.
     *
     * @parameter expression="${rabbit.message}
     * @required
     */
    private String message;

    public void execute() throws MojoExecutionException {
        try {
            getRabbit().say(this.message).go();
        } catch (RabbitException e) {
            throw new MojoExecutionException("Cannot say tts <"+this.message+">", e);
        } catch (IOException e) {
            throw new MojoExecutionException("Cannot say tts <"+this.message+">", e);
        }
    }
    
}
